home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 19 code / SimpliFace_V2 / Sources / PascalString.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-15  |  18.6 KB  |  756 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Friday, December 12, 1990 at 5:44 PM
  4.     PascalString.h 
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1992
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PASCALSTRING__
  15. #define __PASCALSTRING__
  16.  
  17. #ifndef __TEXTUTILS__
  18. #include <TextUtils.h>
  19. #endif
  20.  
  21. #ifndef __STRING__
  22. #include <String.h>
  23. #endif
  24.  
  25. #ifndef __TYPES__
  26. #include <Types.h>
  27. #endif
  28.  
  29. // Forward declaration for all the CString classes.
  30.  
  31. #define kCStringID "cthq:CTLK$CString,1.0"
  32. struct CString;
  33.  
  34. #define kCStr255ID "cthq:CTLK$CStr255,1.0"
  35. struct CStr255;
  36.  
  37. #define kCStr63ID "cthq:CTLK$CStr63,1.0"
  38. struct CStr63;
  39.  
  40. #define kCStr32ID "cthq:CTLK$CStr32,1.0"
  41. struct CStr32;
  42.  
  43. #define kCStr31ID "cthq:CTLK$CStr31,1.0"
  44. struct CStr31;
  45.  
  46. typedef const unsigned char *ConstStr255Param;
  47. typedef ConstStr255Param ConstStr63Param, ConstStr32Param, ConstStr31Param,
  48.                          ConstStr27Param,ConstStr15Param;
  49.  
  50. typedef const CStr255& ConstCStr255Param;
  51. typedef const CStr63& ConstCStr63Param;
  52. typedef const CStr32& ConstCStr32Param;
  53. typedef const CStr31& ConstCStr31Param;
  54.  
  55. #ifndef __OSUTILS__
  56. #include <OSUtils.h>
  57. #endif
  58.  
  59. // typedef unsigned char Str255[256], Str63[64], Str32[33],
  60. //                      Str31[32], Str27[28], Str15[16], *StringPtr, **StringHandle;
  61.  
  62. // Some constants defining the length of each of the CString types.
  63.  
  64. const short kLengthByte = 1;
  65. const short kBaseLen = 2;
  66. const short kStr255Len = 255;
  67. const short kStr63Len = 63;
  68. const short kStr32Len = 32;
  69. const short kStr31Len = 31;
  70.  
  71. // Some external function declarations so that we don't have to include more than
  72. // the minimal set of header files.
  73.  
  74. pascal char* PLSTRSTR(const CString& str1,
  75.                       const CString& str2);        // From PaslibIntf.p
  76.  
  77.  
  78. //----------------------------------------------------------------------------------------
  79. // CString: Superclass of all Pascal string compatible string classes.
  80. //----------------------------------------------------------------------------------------
  81.  
  82. typedef struct CString *CStringPtr, **CStringHandle;
  83.  
  84. struct CString
  85. {
  86. public:
  87.     unsigned char fStr[kBaseLen];
  88.  
  89. protected:
  90.     void InsertHelper(const CString& insStr,
  91.                       short pos,
  92.                       short maxLength);
  93.     void InsertHelper(const char* insStr,
  94.                       short pos,
  95.                       short maxLength);
  96.  
  97. public:
  98.                                     CString();
  99.                                     ~CString();
  100.                                     
  101.     // Basic length method, inherited by all derived classes. Define one that returns a
  102.     // reference. Can be used as an lvalue and only can be applied to non-const Strings.
  103.  
  104.     inline unsigned char& Length()
  105.     {
  106.         return fStr[0];
  107.     }                                            // for non-const CString
  108.  
  109.  
  110.     inline unsigned char Length() const
  111.     {
  112.         return fStr[0];
  113.     }                                            // for const CString
  114.  
  115.  
  116.     inline Boolean IsEmpty()
  117.     {
  118.         return fStr[0] <= 0;
  119.     }
  120.  
  121.     inline Boolean IsEmpty() const
  122.     {
  123.         return fStr[0] <= 0;
  124.     }
  125.  
  126.     // Character selector operator.
  127.  
  128.     unsigned char& operator[](short pos);            // for non-const CString
  129.                                                     // !!! try to inline later
  130.  
  131.     inline unsigned char operator[](short pos) const
  132.     {
  133.         return fStr[pos];
  134.     }                                            // for const CString
  135.     
  136.     //------------------------------------------------------------------------------------
  137.     // CAUTION: There is a subtle difference between the (char*) and (unsigned char*)
  138.     // converstion operators. The first converts a pascal-style string to a c-style
  139.     // string. The second simply converts between two types (CString and Str55) both of
  140.     // which are pascal-style strings.
  141.     
  142.     // Create a NULL terminated c-style string from a pascal-style CString. Used in
  143.     // debugging to fprintf a CString.
  144.     
  145.     operator char*() const;
  146.     
  147.     // Used to create a toolbox type Str255 from our CString. This is simply a type
  148.     // coersion! Both CString and Str255 are expected to be pascal-style strings.
  149.     
  150.     operator unsigned char*();
  151.     
  152.     operator const unsigned char*() const;
  153.  
  154.     //------------------------------------------------------------------------------------
  155.     
  156.     // Return an ID represented as a CString to the actual ID (a long).
  157.     
  158.     operator long() const;
  159.  
  160.     // Relational operators that are inherited by all the derived CString types. Three of
  161.     // each so that literal C Strings can be conveniently used for one of the operators as
  162.     // well as two of the derive classes as operators. These are declared here but defined
  163.     // below all the CString classes because they use constructors for CStr255 and its class
  164.     // definition has not been encountered yet.
  165.  
  166.     friend Boolean operator==(const CString& s1,
  167.                                      const char* s2);
  168.     friend Boolean operator==(const char* s1,
  169.                                      const CString& s2);
  170.     friend Boolean operator==(const CString& s1,
  171.                                      const CString& s2);
  172.  
  173.     friend Boolean operator!=(const CString& s1,
  174.                                      const char* s2);
  175.     friend Boolean operator!=(const char* s1,
  176.                                      const CString& s2);
  177.     friend Boolean operator!=(const CString& s1,
  178.                                      const CString& s2);
  179.  
  180.     friend Boolean operator>(const CString& s1,
  181.                                     const char* s2);
  182.     friend Boolean operator>(const char* s1,
  183.                                     const CString& s2);
  184.     friend Boolean operator>(const CString& s1,
  185.                                     const CString& s2);
  186.  
  187.     friend Boolean operator<(const CString& s1,
  188.                                     const char* s2);
  189.     friend Boolean operator<(const char* s1,
  190.                                     const CString& s2);
  191.     friend Boolean operator<(const CString& s1,
  192.                                     const CString& s2);
  193.  
  194.     friend Boolean operator>=(const CString& s1,
  195.                                      const char* s2);
  196.     friend Boolean operator>=(const char* s1,
  197.                                      const CString& s2);
  198.     friend Boolean operator>=(const CString& s1,
  199.                                      const CString& s2);
  200.  
  201.     friend Boolean operator<=(const CString& s1,
  202.                                      const char* s2);
  203.     friend Boolean operator<=(const char* s1,
  204.                                      const CString& s2);
  205.     friend Boolean operator<=(const CString& s1,
  206.                                      const CString& s2);
  207.  
  208.     // Concatenation operator that are inherited by all the derived CString types. Three
  209.     // of each so that literal C Strings can be conveniently used for one of the operators
  210.     // as well as using any two classes derived from CString.
  211.  
  212.     friend CStr255 operator+(const CString& s1,
  213.                             const char* s2);
  214.     friend CStr255 operator+(const char* s1,
  215.                             const CString& s2);
  216.     friend CStr255 operator+(const CString& s1,
  217.                             const CString& s2);
  218.  
  219.     // Methods that mimic the Pascal builtin CString functions for Pos, Insert and Delete.
  220.     // Note that insert and copy is implemented in the derived classes.
  221.  
  222.     unsigned char Pos(const char* subStr, unsigned char startPos = 1);
  223.     unsigned char Pos(const CString& subStr, unsigned char startPos = 1);
  224.     inline void Delete(short pos, short length);
  225. };
  226.  
  227. //----------------------------------------------------------------------------------------
  228. // CStr255:
  229. //----------------------------------------------------------------------------------------
  230.  
  231. struct CStr255 : CString
  232. {
  233.  
  234.     friend struct CStr63;
  235.     friend struct CStr31;
  236.  
  237. private:
  238.     unsigned char fData[kStr255Len - 1];
  239.  
  240. public:
  241.     CStr255();
  242.     ~CStr255();
  243.     CStr255(const CStr255& str);
  244.     CStr255(const CStr63& str);
  245.     CStr255(const CStr32& str);
  246.     CStr255(const CStr31& str);
  247.     CStr255(const unsigned char* str);
  248.     CStr255(const char* str);
  249.     CStr255(const long id);
  250.  
  251.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  252.     
  253.     void Insert(const CString& str, short pos);
  254.     void Insert(const char* str, short pos);
  255.     CStr255 Copy(short pos, short length);
  256.                        
  257.     // Concatenation operator
  258.     
  259.     CStr255& operator +=(const CString& str);
  260.     CStr255& operator +=(const char* str);
  261.     CStr255& operator +=(const char ch);
  262.  
  263.     // Assignment operator
  264.  
  265.     CStr255& operator =(const CStr255& str);
  266.     CStr255& operator =(const CStr63& str);
  267.     CStr255& operator =(const CStr32& str);
  268.     CStr255& operator =(const CStr31& str);
  269.     CStr255& operator =(const unsigned char* str);
  270.     CStr255& operator =(const char aChar);
  271.     CStr255& operator =(const char* str);
  272.     
  273. };
  274.  
  275.  
  276. //----------------------------------------------------------------------------------------
  277. // CStr63:
  278. //----------------------------------------------------------------------------------------
  279.  
  280. struct CStr63 : CString
  281. {
  282.  
  283.     friend struct CStr255;
  284.     friend struct CStr31;
  285.  
  286. private:
  287.     unsigned char fData[kStr63Len - 1];
  288.  
  289. public:
  290.     CStr63();
  291.     ~CStr63();
  292.     CStr63(const CStr255& str);
  293.     CStr63(const CStr63& str);
  294.     CStr63(const CStr32& str);
  295.     CStr63(const CStr31& str);
  296.     CStr63(const unsigned char* str);
  297.     CStr63(const char* str);
  298.     CStr63(const long id);
  299.  
  300.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  301.     
  302.     void Insert(const CString& str,
  303.                        short pos);
  304.     void Insert(const char* str,
  305.                        short pos);
  306.     CStr63 Copy(short pos, short length);
  307.  
  308.     // Concatenation operator
  309.     
  310.     CStr63& operator +=(const CString& str);
  311.     CStr63& operator +=(const char* str);
  312.     CStr63& operator +=(const char ch);
  313. };
  314.  
  315.  
  316. //----------------------------------------------------------------------------------------
  317. // CStr32:
  318. //----------------------------------------------------------------------------------------
  319.  
  320. struct CStr32 : CString
  321. {
  322.  
  323.     friend struct CStr255;
  324.     friend struct CStr63;
  325.  
  326. private:
  327.     unsigned char fData[kStr32Len - 1];
  328.  
  329. public:
  330.     CStr32();
  331.     ~CStr32();
  332.     inline CStr32(unsigned char length)
  333.     {
  334.         fStr[0] = length;
  335.     }
  336.  
  337.  
  338.     CStr32(const CStr255& str);
  339.     CStr32(const CStr63& str);
  340.     CStr32(const CStr32& str);
  341.     CStr32(const CStr31& str);
  342.     CStr32(const unsigned char* str);
  343.     CStr32(const char* str);
  344.     CStr32(const long id);
  345.  
  346.  
  347.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  348.     
  349.     void Insert(const CString& str,
  350.                        short pos);
  351.     void Insert(const char* str,
  352.                        short pos);
  353.     CStr32 Copy(short pos, short length);
  354.  
  355.     // Concatenation operator
  356.     
  357.     CStr32& operator +=(const CString& str);
  358.     CStr32& operator +=(const char* str);
  359.     CStr32& operator +=(const char ch);
  360. };
  361.  
  362.  
  363. //----------------------------------------------------------------------------------------
  364. // CStr31:
  365. //----------------------------------------------------------------------------------------
  366.  
  367. struct CStr31 : CString
  368. {
  369.  
  370.     friend struct CStr255;
  371.     friend struct CStr63;
  372.     friend struct CStr32;
  373.  
  374. private:
  375.     unsigned char fData[kStr31Len - 1];
  376.  
  377. public:
  378.     ~CStr31();
  379.     CStr31();
  380.     inline CStr31(unsigned char length)
  381.     {
  382.         fStr[0] = length;
  383.     }
  384.  
  385.  
  386.     CStr31(const CStr255& str);
  387.     CStr31(const CStr63& str);
  388.     CStr31(const CStr32& str);
  389.     CStr31(const CStr31& str);
  390.     CStr31(const unsigned char* str);
  391.     CStr31(const char* str);
  392.     CStr31(const long id);
  393.  
  394.     // Insert and Copy roughly equivalent to the Pascal Insert and Copy functions.
  395.     
  396.     void Insert(const CString& str,
  397.                        short pos);
  398.     void Insert(const char* str,
  399.                        short pos);
  400.     CStr31 Copy(short pos, short length);
  401.  
  402.     // Concatenation operator
  403.     
  404.     CStr31& operator +=(const CString& str);
  405.     CStr31& operator +=(const char* str);
  406.     CStr31& operator +=(const char ch);
  407. };
  408.  
  409.  
  410. //----------------------------------------------------------------------------------------
  411. // CString inline function definitions
  412. //----------------------------------------------------------------------------------------
  413.  
  414. inline CString::operator unsigned char*()
  415. {
  416.     return (unsigned char *) this;
  417. }
  418.  
  419. inline void CString::Delete(short pos, short length)
  420. {
  421.     if ((pos > 0) && (length > 0) && (pos <= Length()))    // should also check that pos <= kMaxLength
  422.     {
  423.         if (pos + length > Length())
  424.             fStr[0] = pos - 1;
  425.         else
  426.         {
  427.             memcpy(&fStr[pos], &fStr[pos + length], Length() - (pos + length) + kLengthByte);
  428.             fStr[0] -= length;
  429.         }
  430.     }
  431. }
  432.  
  433.  
  434. //----------------------------------------------------------------------------------------
  435. // CStr255 inline function definitions
  436. //----------------------------------------------------------------------------------------
  437. inline CStr255::CStr255(const CStr255& str)
  438. {
  439.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  440. }
  441.  
  442. inline CStr255::CStr255(const CStr63& str)
  443. {
  444.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  445. }
  446.  
  447. inline CStr255::CStr255(const CStr32& str)
  448. {
  449.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  450. }
  451.  
  452. inline CStr255::CStr255(const CStr31& str)
  453. {
  454.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  455. }
  456.  
  457. inline CStr255::CStr255(const unsigned char* str)
  458. {
  459.     memcpy(fStr, str, kStr255Len + kLengthByte);
  460. }
  461.  
  462. inline CStr255& CStr255::operator = (const CStr255& str)
  463. {
  464.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  465.     
  466.     return *this;
  467. }
  468.  
  469. inline CStr255& CStr255::operator = (const CStr63& str)
  470. {
  471.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  472.     
  473.     return *this;
  474. }
  475.  
  476. inline CStr255& CStr255::operator = (const CStr32& str)
  477. {
  478.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  479.     
  480.     return *this;
  481. }
  482.  
  483. inline CStr255& CStr255::operator = (const CStr31& str)
  484. {
  485.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  486.     
  487.     return *this;
  488. }
  489.  
  490. inline CStr255& CStr255::operator = (const unsigned char* str)
  491. {
  492.     memcpy(fStr, str, kStr255Len + kLengthByte);
  493.     
  494.     return *this;
  495. }
  496.  
  497. inline CStr255& CStr255::operator = (const char aChar)
  498. {
  499.     if (aChar == '\0')                        // passing in an NULL char
  500.         Length() = 0;
  501.     else
  502.     {
  503.         Length() = 1;                        // CString gets length of 1
  504.         fStr[1] = aChar;                    // assign in the character
  505.     }
  506.     
  507.     return *this;
  508. }
  509.  
  510. inline void CStr255::Insert(const CString& str, short pos)
  511. {
  512.     InsertHelper(str, pos, kStr255Len);
  513. }
  514.  
  515. inline void CStr255::Insert(const char* str, short pos)
  516. {
  517.     InsertHelper(str, pos, kStr255Len);
  518. }
  519.  
  520.  
  521. //----------------------------------------------------------------------------------------
  522. // CStr63 inline function definitions
  523. //----------------------------------------------------------------------------------------
  524.  
  525. inline CStr63::CStr63(const CStr255& str)
  526. {
  527.     // Truncate the CStr255 to 63 bytes if necessary.
  528.  
  529.     Length() = str.Length() > kStr63Len ? kStr63Len : str.Length();
  530.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  531. }
  532.  
  533. inline CStr63::CStr63(const CStr63& str)
  534. {
  535.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  536. }
  537.  
  538. inline CStr63::CStr63(const CStr32& str)
  539. {
  540.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  541. }
  542.  
  543. inline CStr63::CStr63(const CStr31& str)
  544. {
  545.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  546. }
  547.  
  548. inline CStr63::CStr63(const unsigned char* str)
  549. {
  550.     memcpy(fStr, str, kStr63Len + kLengthByte);
  551. }
  552.  
  553. inline void CStr63::Insert(const CString& str, short pos)
  554. {
  555.     InsertHelper(str, pos, kStr63Len);
  556. }
  557.  
  558. inline void CStr63::Insert(const char* str, short pos)
  559. {
  560.     InsertHelper(str, pos, kStr63Len);
  561. }
  562.  
  563.  
  564. //----------------------------------------------------------------------------------------
  565. // CStr32 inline function definitions
  566. //----------------------------------------------------------------------------------------
  567.  
  568. inline CStr32::CStr32(const CStr255& str)
  569. {
  570.     // Truncate the CStr255 to 32 bytes if necessary.
  571.  
  572.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  573.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  574. }
  575.  
  576. inline CStr32::CStr32(const CStr63& str)
  577. {
  578.     // Truncate the CStr63 to 32 bytes if necessary.
  579.  
  580.     Length() = str.Length() > kStr32Len ? kStr32Len : str.Length();
  581.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  582. }
  583.  
  584. inline CStr32::CStr32(const CStr32& str)
  585. {
  586.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  587. }
  588.  
  589. inline CStr32::CStr32(const CStr31& str)
  590. {
  591.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  592. }
  593.  
  594. inline CStr32::CStr32(const unsigned char* str)
  595. {
  596.     memcpy(fStr, str, kStr31Len + kLengthByte);
  597. }
  598.  
  599. inline void CStr32::Insert(const CString& str, short pos)
  600. {
  601.     InsertHelper(str, pos, kStr32Len);
  602. }
  603.  
  604. inline void CStr32::Insert(const char* str, short pos)
  605. {
  606.     InsertHelper(str, pos, kStr32Len);
  607. }
  608.  
  609.  
  610. //----------------------------------------------------------------------------------------
  611. // CStr31 inline function definitions
  612. //----------------------------------------------------------------------------------------
  613.  
  614. inline CStr31::CStr31(const CStr255& str)
  615. {
  616.     // Truncate the CStr255 to 31 bytes if necessary.
  617.  
  618.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  619.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  620. }
  621.  
  622. inline CStr31::CStr31(const CStr63& str)
  623. {
  624.     // Truncate the CStr63 to 31 bytes if necessary.
  625.  
  626.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  627.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  628. }
  629.  
  630. inline CStr31::CStr31(const CStr32& str)
  631. {
  632.     // Truncate the CStr32 to 31 bytes if necessary.
  633.  
  634.     Length() = str.Length() > kStr31Len ? kStr31Len : str.Length();
  635.     memcpy(fStr, str.fStr, Length() + kLengthByte);
  636. }
  637.  
  638. inline CStr31::CStr31(const CStr31& str)
  639. {
  640.     memcpy(fStr, str.fStr, str.Length() + kLengthByte);
  641. }
  642.  
  643. inline CStr31::CStr31(const unsigned char* str)
  644. {
  645.     memcpy(fStr, str, kStr31Len + kLengthByte);
  646. }
  647.  
  648. inline void CStr31::Insert(const CString& str, short pos)
  649. {
  650.     InsertHelper(str, pos, kStr31Len);
  651. }
  652.  
  653. inline void CStr31::Insert(const char* str, short pos)
  654. {
  655.     InsertHelper(str, pos, kStr31Len);
  656. }
  657.  
  658.  
  659. //----------------------------------------------------------------------------------------
  660. // Inline friend function definitions for relational string operators.
  661. //----------------------------------------------------------------------------------------
  662.  
  663. inline Boolean operator==(const CString& s1, const char* s2)
  664. {
  665.     return RelString(s1, CStr255(s2), false, true) == 0;
  666. }
  667.  
  668. inline Boolean operator==(const char* s1, const CString& s2)
  669. {
  670.     return RelString(CStr255(s1), s2, false, true) == 0;
  671. }
  672.  
  673. inline Boolean operator==(const CString& s1, const CString& s2)
  674. {
  675.     return RelString(s1, s2, false, true) == 0;
  676. }
  677.  
  678. inline Boolean operator!=(const CString& s1, const char* s2)
  679. {
  680.     return RelString(s1, CStr255(s2), false, true) != 0;
  681. }
  682.  
  683. inline Boolean operator!=(const char* s1, const CString& s2)
  684. {
  685.     return RelString(CStr255(s1), s2, false, true) != 0;
  686. }
  687.  
  688. inline Boolean operator!=(const CString& s1, const CString& s2)
  689. {
  690.     return RelString(s1, s2, false, true) != 0;
  691. }
  692.  
  693. inline Boolean operator>(const CString& s1, const char* s2)
  694. {
  695.     return RelString(s1, CStr255(s2), false, true) > 0;
  696. }
  697.  
  698. inline Boolean operator>(const char* s1, const CString& s2)
  699. {
  700.     return RelString(CStr255(s1), s2, false, true) > 0;
  701. }
  702.  
  703. inline Boolean operator>(const CString& s1, const CString& s2)
  704. {
  705.     return RelString(s1, s2, false, true) > 0;
  706. }
  707.  
  708. inline Boolean operator<(const CString& s1, const char* s2)
  709. {
  710.     return RelString(s1, CStr255(s2), false, true) < 0;
  711. }
  712.  
  713. inline Boolean operator<(const char* s1, const CString& s2)
  714. {
  715.     return RelString(CStr255(s1), s2, false, true) < 0;
  716. }
  717.  
  718. inline Boolean operator<(const CString& s1, const CString& s2)
  719. {
  720.     return RelString(s1, s2, false, true) < 0;
  721. }
  722.  
  723. inline Boolean operator>=(const CString& s1, const char* s2)
  724. {
  725.     return RelString(s1, CStr255(s2), false, true) >= 0;
  726. }
  727.  
  728. inline Boolean operator>=(const char* s1, const CString& s2)
  729. {
  730.     return RelString(CStr255(s1), s2, false, true) >= 0;
  731. }
  732.  
  733. inline Boolean operator>=(const CString& s1, const CString& s2)
  734. {
  735.     return RelString(s1, s2, false, true) >= 0;
  736. }
  737.  
  738. inline Boolean operator<=(const CString& s1, const char* s2)
  739. {
  740.     return RelString(s1, CStr255(s2), false, true) <= 0;
  741. }
  742.  
  743. inline Boolean operator<=(const char* s1, const CString& s2)
  744. {
  745.     return RelString(CStr255(s1), s2, false, true) <= 0;
  746. }
  747.  
  748. inline Boolean operator<=(const CString& s1, const CString& s2)
  749. {
  750.     return RelString(s1, s2, false, true) <= 0;
  751. }
  752.  
  753.  
  754. #endif
  755.  
  756.